package com.hspedu.newData.剑指offer;

import org.junit.Test;

/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-04 
 * @Version: 1.0
 */

public class LCR121寻找目标值二维数组 {


    // todo
    // 不知道咋做
    public boolean findTargetIn2DPlants(int[][] plants, int target) {

        int i = plants.length - 1, j = 0;
        while(i >= 0 && j < plants[0].length)
        {
            if(plants[i][j] > target) i--;
            else if(plants[i][j] < target) j++;
            else return true;
        }
        return false;
    }


    @Test
    public void test() {
        // 测试代码

        findTargetIn2DPlants(new int[][]{{1,3,5},{2,5,7}},4);
    }
}
